package indi.defoliation.unknownrpg.api.rpgevent.player;

import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;

import indi.defoliation.unknownrpg.api.attribute.Attribute;
import indi.defoliation.unknownrpg.api.attribute.AttributeBody;
import indi.defoliation.unknownrpg.api.rpgevent.Cancellable;

public class PlayerSetupEvent extends PlayerEvent implements Cancellable{
	
	private ItemStack item;
	private AttributeBody location;
	private boolean cancel;
	
	public PlayerSetupEvent(Player who,ItemStack what,AttributeBody location) {
		super(who);
		this.item=what;
		this.location=location;
	}
	
	public ItemStack getItem() {
		return item;
	}
	public AttributeBody getLocation() {
		return location;
	}
	
	public void setItemStack(Attribute operoter,ItemStack item) {
		this.item=item;
		super.putLog(operoter, this.clone());
	}

	@Override
	public void setCancelled(Attribute operoter, boolean cance) {
		if(this.cancel==cance)
			return;
		this.cancel=cance;
		super.getTable().addAction(operoter, super.clone());
	}

	@Override
	public boolean isCancelled() {
		return cancel;
	}

}
